<?php

namespace app\popo\vo;

use app\popo\BaseVO;

/**
 * 今日数据VO
 */
class BusinessDataVO extends BaseVO
{
    /**
     * 营业额
     */
    public float $turnover;

    /**
     * 有效订单数
     */
    public int $validOrderCount;

    /**
     * 订单完成率
     */
    public float $orderCompletionRate;

    /**
     * 平均客单价
     */
    public float $unitPrice;

    /**
     * 新增用户数
     */
    public int $newUsers;

    public function getTurnover(): float
    {
        return $this->turnover ?? 0.0;
    }

    public function setTurnover(float $turnover): void
    {
        $this->turnover = $turnover;
    }

    public function getValidOrderCount(): int
    {
        return $this->validOrderCount ?? 0;
    }

    public function setValidOrderCount(int $validOrderCount): void
    {
        $this->validOrderCount = $validOrderCount;
    }

    public function getOrderCompletionRate(): float
    {
        return $this->orderCompletionRate ?? 0.0;
    }

    public function setOrderCompletionRate(float $orderCompletionRate): void
    {
        $this->orderCompletionRate = $orderCompletionRate;
    }

    public function getUnitPrice(): float
    {
        return $this->unitPrice ?? 0.0;
    }

    public function setUnitPrice(float $unitPrice): void
    {
        $this->unitPrice = $unitPrice;
    }

    public function getNewUsers(): int
    {
        return $this->newUsers ?? 0;
    }

    public function setNewUsers(int $newUsers): void
    {
        $this->newUsers = $newUsers;
    }

    public function toArray(): array
    {
        return [
            'turnover' => $this->turnover ?? 0.0,
            'validOrderCount' => $this->validOrderCount ?? 0,
            'orderCompletionRate' => $this->orderCompletionRate ?? 0.0,
            'unitPrice' => $this->unitPrice ?? 0.0,
            'newUsers' => $this->newUsers ?? 0
        ];
    }
}